<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Promise的all方法调用</title>
</head>

<body>
  <script>
    Promise.all([
      new Promise((resolve, reject) => {
        // 真实开发使用的不是ajax请求
        setTimeout(() => {
          resolve('result1')//可以传递字符串
        }, 2000)
      }),
      new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve({name:'likewie',age:18})//可以传递对象
        }, 1000)
      })
    ]).then(ret => {
      console.log(ret); //打印最终结果
      // 结果是数组，数组里面存放一个字符串和一个对象
      // 对象是可以进行处理的
    })
  </script>
</body>

</html>